#ifndef _ENTITY_H
#define _ENTITY_H

#include <vector>
#include "entitycomponent.h"

enum ComponentType;

class Entity
{
public:
	Entity();
	~Entity();
	void addComponent(EntityComponent *c);
	EntityComponent* getComponent(ComponentType type);
	const EntityComponent* getComponent(ComponentType type) const;
	void removeComponent(ComponentType type);
private:
	std::vector<EntityComponent*> mComponents;

		class EqPred
	{
		EntityComponent *mComp;
	public:
		bool operator()(const EntityComponent *c)
		{
			return mComp == c;
		}
		EqPred(EntityComponent *c)
			:mComp(c)
		{
		}
	};

	class TypeEqPred
	{
	public:
		TypeEqPred(ComponentType t)
			:mType(t)
		{
		}
		bool operator()(const EntityComponent *c)
		{
			return mType == c->type();
		}
	private:
		ComponentType mType;
	};

};

#endif	//_ENTITY_H